Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightmode for Query Performance Toast #5004

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

CamronStaley
Copy link
Contributor

@CamronStaley CamronStaley commented Oct 30, 2024

What changes are proposed in this pull request?

Adding light mode support

How is this patch tested? If it is not, please explain why.

image

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features

    • Updated color scheme in the ThemeProvider for improved visual consistency.
    • Enhanced toast visibility behavior to improve user experience.
  • Bug Fixes

    • Adjusted default visibility of the QueryPerformanceToast to prevent unnecessary display on initial load.
    • Updated button color in the primary action for better visibility.

@CamronStaley CamronStaley self-assigned this Oct 30, 2024
Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Walkthrough

The changes involve modifications to two components: QueryPerformanceToast and ThemeProvider. In QueryPerformanceToast, the default visibility state of the toast has been changed from true to false, affecting its initial rendering. In ThemeProvider, specific color properties within the light color scheme have been updated, including a change from a hex value to an HSL value for lightning and an update to toastBackgroundColor. No alterations were made to the overall structure or public entity declarations in either component.

Changes

File Path Change Summary
app/packages/app/src/components/QueryPerformanceToast.tsx Changed initial state of shown from true to false, affecting toast visibility on mount.
app/packages/components/src/components/ThemeProvider/index.tsx Updated lightning color from #f5b700 to hsl(25, 100%, 51%) and toastBackgroundColor from #333 to #FFFFFF.

Possibly related PRs

  • make it pretty #4999: This PR modifies the QueryPerformanceToast component, which is directly related to the main PR's changes in the same component, specifically altering the visibility behavior and styling.

Suggested reviewers

  • minhtuev
  • ritch
  • benjaminpkane

Poem

🐰 In the garden where toasts bloom bright,
A change in the theme brings colors to light.
From shadows they leap, with hues so grand,
A toast to the changes, let's all take a stand!
With HSL's charm and a new start to show,
We hop with delight as the updates bestow! 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3506dae and 06e17aa.

📒 Files selected for processing (2)
  • app/packages/app/src/components/QueryPerformanceToast.tsx (2 hunks)
  • app/packages/components/src/components/ThemeProvider/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/packages/app/src/components/QueryPerformanceToast.tsx
  • app/packages/components/src/components/ThemeProvider/index.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
app/packages/app/src/components/QueryPerformanceToast.tsx (3)

Line range hint 46-48: Consider consolidating styles in theme configuration

The inline styles and repeated theme references could be simplified by moving common values to theme constants.

Consider refactoring to use sx prop consistently:

- style={{ marginLeft: "auto", color: theme.text.secondary }}
+ sx={{ marginLeft: "auto", color: theme.text.secondary }}

Also, consider creating theme constants for commonly used style combinations:

const toastButtonStyles = {
  marginLeft: "auto",
  color: theme.text.secondary,
};

Also applies to: 67-67


Line range hint 43-106: Enhance accessibility for toast notifications

The toast component could benefit from improved accessibility features to better support screen readers and keyboard navigation.

Consider adding these accessibility enhancements:

 <Toast
+  role="alert"
+  aria-live="polite"
   duration={SHOWN_FOR}
   layout={{ bottom: '100px', vertical: "bottom", horizontal: "center", backgroundColor: theme.custom.toastBackgroundColor}}
   // ... rest of the props
 >

Also consider:

  1. Adding keyboard shortcuts for dismissing the toast (e.g., Escape key)
  2. Ensuring proper focus management when the toast appears
  3. Adding aria-label to the Bolt icon for screen readers

Line range hint 35-38: Consider adding error boundary protection

While the event listener cleanup is properly handled, the component could benefit from better error handling.

Consider wrapping the component with an error boundary to gracefully handle rendering failures:

class QueryPerformanceToastErrorBoundary extends React.Component {
  componentDidCatch(error: Error) {
    console.error('Failed to render QueryPerformanceToast:', error);
    // Optional: report to error tracking service
  }
  
  render() {
    return this.props.children;
  }
}

// Usage:
export default function QueryPerformanceToastWithErrorBoundary() {
  return (
    <QueryPerformanceToastErrorBoundary>
      <QueryPerformanceToast />
    </QueryPerformanceToastErrorBoundary>
  );
}
app/packages/components/src/components/ThemeProvider/index.tsx (1)

96-97: Use consistent HSL format for color values.

While the changes look good, the toastBackgroundColor uses hex format (#FFFFFF) which is inconsistent with the HSL format used throughout the theme. Consider using HSL for consistency.

  custom: {
    lightning: "hsl(25, 100%, 51%)",
-   toastBackgroundColor: "#FFFFFF",
+   toastBackgroundColor: "hsl(0, 0%, 100%)",
  },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 52bc6a2 and 49b752b.

📒 Files selected for processing (2)
  • app/packages/app/src/components/QueryPerformanceToast.tsx (1 hunks)
  • app/packages/components/src/components/ThemeProvider/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/packages/app/src/components/QueryPerformanceToast.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/components/src/components/ThemeProvider/index.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (2)
app/packages/app/src/components/QueryPerformanceToast.tsx (1)

24-24: Good improvement to initial state management!

Setting the initial state to false prevents unwanted flash of content and aligns with toast notification best practices.

app/packages/components/src/components/ThemeProvider/index.tsx (1)

96-97: LGTM! Changes align with light mode support.

The color changes appropriately support the light mode for Query Performance Toast:

  • Changed lightning color to a more maintainable HSL format
  • Updated toastBackgroundColor to white for light mode visibility

@CamronStaley CamronStaley changed the base branch from develop to release/v1.1.0 October 30, 2024 15:44
Copy link
Contributor

@minhtuev minhtuev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Cam!

@CamronStaley CamronStaley merged commit ed9d3c2 into release/v1.1.0 Oct 30, 2024
11 checks passed
@CamronStaley CamronStaley deleted the bug/qp-lightmode branch October 30, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants